/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   list_insertion.h                                   :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: Jiang <767280080@qq.com>                   +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2024/04/23 12:02:19 by Jiang             #+#    #+#             */
/*   Updated: 2024/04/23 12:02:19 by Jiang            ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#ifndef __list_insertion__
#define __list_insertion__

template <typename T> void List<T>::insertionSort(ListNodePosi<T> p, Rank n) {
  for (Rank r = 0; r < n; ++r) {
    insert(search(p->data, r, p), p->data);
    p = p->next;
    remove(p->prev);
  }
}

#endif // !__list_insertion__
